
const baseUrl = 'https://www.signzg.com';
// const baseUrl = 'http://192.168.10.44:8089';
// const baseUrl='http://w94aqv.natappfree.cc';
// const baseUrl='http://192.168.10.23:8092'
var headers;
// 
const request = (type = '', data = {}, url = '', header) => {
	return new Promise((resolve, reject) => {
		headers = !header ? {} : header,
		headers['Content-Type'] = 'application/json;charset=utf-8';
		uni.request({
			method: type,
			url: baseUrl + url,
			data,
			header: headers,
			dataType: 'json',
			timeout: 20000,
		}).then((response) => {
			console.log(response);
			setTimeout(function() {
				uni.hideLoading();
			}, 200);
			let [error, res] = response;
			resolve(res.data);
		}).catch(error => {
			let [err, res] = error;
			reject(err)
		})
	});
}


export default request;
